package com.joysuch.wwyt.bp.bean.inspect;

import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/7/30 15:21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BpInspectFinishRateDto {

    @ApiModelProperty("巡检数量")
    private Integer inspectSum;

    @ApiModelProperty("多模块公用字段: 完成情况 or 异常情况")
    private List<BpInspectFinishRateDetailDto> detailDtoList;

    public static BpInspectFinishRateDto defaultFinishDto() {
        List<BpInspectFinishRateDetailDto> detailDtoList = Lists.newArrayList();
        detailDtoList.add(new BpInspectFinishRateDetailDto("未完成", 0));
        detailDtoList.add(new BpInspectFinishRateDetailDto("完成", 0));
        return new BpInspectFinishRateDto(0, detailDtoList);
    }

    public static BpInspectFinishRateDto dataFinishDto(int totalSize, int finishSum, int unFinishSum) {
        List<BpInspectFinishRateDetailDto> detailDtoList = Lists.newArrayList();
        detailDtoList.add(new BpInspectFinishRateDetailDto("未完成", unFinishSum));
        detailDtoList.add(new BpInspectFinishRateDetailDto("完成", finishSum));
        return new BpInspectFinishRateDto(totalSize, detailDtoList);
    }

    public static BpInspectFinishRateDto defaultExceptionDto() {
        List<BpInspectFinishRateDetailDto> detailDtoList = Lists.newArrayList();
        detailDtoList.add(new BpInspectFinishRateDetailDto("异常", 0));
        detailDtoList.add(new BpInspectFinishRateDetailDto("正常", 0));
        return new BpInspectFinishRateDto(0, detailDtoList);
    }

    public static BpInspectFinishRateDto dataExceptionDto(int totalSize, int normalSum, int abnormalSum) {
        List<BpInspectFinishRateDetailDto> detailDtoList = Lists.newArrayList();
        detailDtoList.add(new BpInspectFinishRateDetailDto("异常", abnormalSum));
        detailDtoList.add(new BpInspectFinishRateDetailDto("正常", normalSum));
        return new BpInspectFinishRateDto(totalSize, detailDtoList);
    }

}
